KERNELRELEASE	:= $(shell uname -r)
KERNEL_SOURCE	:= /lib/modules/$(KERNELRELEASE)/build
PWD		:= $(shell pwd)

EXTRA_CFLAGS	+= -Wall -Werror

ifdef DEFS
EXTRA_CFLAGS	+= $(DEFS)
endif


obj-m		+= my-fujitsu-tablet.o

all: $(obj-m:.o=.ko)
modules: $(obj-m:.o=.ko)
modules_install: install

$(obj-m:.o=.ko): $(obj-m:.o=.c)
	$(MAKE) -C $(KERNEL_SOURCE) M=$(PWD) modules

install: $(obj-m:.o=.ko)
	$(MAKE) -C $(KERNEL_SOURCE) M=$(PWD) modules_install

uninstall:
	rm -f /lib/modules/$(KERNELRELEASE)/extra/fujitsu-tablet2.ko

clean:
	$(MAKE) -C $(KERNEL_SOURCE) M=$(PWD) clean

distclean: clean
	rm -f Module.symvers

distdir: Makefile my-fujitsu-tablet.c
	cp -p $^ $(distdir)

%:
	@echo; \
	 echo " *** unknown target $@ *** "; \
	 echo

force_look:
	true

.PHONY: all install modules modules_install clean
